<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        
    </head>
    <body>
        <div id="test"></div>

        <script src="https://unpkg.com/react@16/umd/react.development.js"></script>
        <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
        <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
        <script type="text/babel">
            //1.创建函数式组件
            function MyComponent(){
                console.log(this);//这里的this是undefined,   因为babel编译后开启了严格模式   严格模式禁止自定义函数this指向win
                return <h2>我是用函数定义的组件(适用于简单组件的定义)</h2>
            }
            // 2.渲染组件到页面
            ReactDOM.render(<MyComponent/>,document.getElementById('test'));

            /* 
                执行了ReactDOM.render(<MyComponent/>,document.getElementById('test'));  之后发生了什么?
                    1.React解析组件标签,找到了MyComponent组件
                    2.发现组件是使用函数定义的,随后调用该函数,将返回的虚拟DOM转为真实的DOM,随后呈现在页面
            
            */
        </script>
    </body>
</html>